package com.xlh.openai.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class Knife4jConfiguration {


    @Bean(value = "defaultApi2")
    public Docket defaultApi2() {
        // 便于压力测试或者产生测试数据
        Contact contact = new Contact("初方政", "", "1280251739@qq.com");
        Docket docket = new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        .title("OPENAI")
                        .contact( contact )
                        .description("OPENAI 接口APi")
                        .termsOfServiceUrl("http://www.xx.com/")
                        .version("1.0")
                        .build())
                .groupName("2.X版本")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.xlh"))
                .paths(PathSelectors.any())
                .build();
        return docket;
    }
}